﻿<%@ Page Title="常见问题_首页" Language="C#" MasterPageFile="~/ePioneer/MasterPage.master" AutoEventWireup="true"
    CodeFile="ep_question_list.aspx.cs" Inherits="ePioneer_ep_question_list" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript" src="javascript/js_ep_question.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">
        function QueryString() {
            var name, value, i;
            var str = location.href;
            var num = str.indexOf("?");
            str = str.substr(num + 1);
            var arrtmp = str.split("&");
            for (i = 0; i < arrtmp.length; i++) {
                num = arrtmp[i].indexOf("=");
                if (num > 0) {
                    name = arrtmp[i].substring(0, num);
                    value = arrtmp[i].substr(num + 1);
                    this[name] = value;
                }
            }
        }
        $(document).ready(function () {
            var request = new QueryString();
            var isolve = 1;
            if (request["sid"] != null && request["sid"] != "") {
                isolve = request["sid"];
            }
            GetSolutionQ(isolve);
            $("#cq_queset2").click(function () {
                window.location.href = "ep_question_userques.aspx?cp=2&tid=" + $("#hid_questiontype").val();
            });

            $("#cp_queset1").click(function () {
                window.location.href = "ep_question_userques.aspx?cp=1&tid=" + $("#hid_questiontype").val();
            });

            $(".dp_m .cnt .topbar .navi .nitem5").addClass("naover5");
            $("#itemsboxwrap").css("margin-left", "-200px");
        });

        //已解决和未解决
        function GetSolutionQ(iSolve) {
            $('#hid_questionsolve').val(iSolve);
            GetBigClassNav(12);
            GetState(iSolve, 1);
        }
        //获取数据
        function GetQuestionByType(iSolve, iType, count) {
            $("#hid_thispage").val(1);
            if (iSolve != -1) {
                $('#hid_questionsolve').val(iSolve);
            }
            else {
                iSolve = $('#hid_questionsolve').val();
            }
            $("#hid_questiontype").val(iType);
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "json",
                data: { action: "GetQuestionByTypeID", iTid: iType, iSid: iSolve, count: count, page: 1 },
                success: function (result) {
                    $(".cq_labcnt .lcnt").css("display", "");
                    $("#listQuestion").html(result[0]);
                    $("#Pagination").html(result[1]);
                }
            });
        }

        //翻页
        function GetQuestionByPage(page) {
            var thispage = $("#hid_thispage").val();
            if (page == "p") {
                page = new Number(thispage) - 1;
            }
            if (page == "n") {
                page = new Number(thispage) + 1;
            }
            if (page == "g") {
                page = new Number(thispage) + 10;
            }
            if (page == "b") {
                page = new Number(thispage) - 10;
            }
            $("#hid_thispage").val(page);
            var iSolve = $('#hid_questionsolve').val();
            var iType = $("#hid_questiontype").val();
            var count = 10;
            if ($(".cq_labcnt .subclassnav").is(":hidden"))
                count = 11;
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "json",
                data: { action: "GetQuestionByTypeID", iTid: iType, iSid: iSolve, count: count, page: page },
                success: function (result) {
                    $("#listQuestion").html(result[0]);
                    $("#Pagination").html(result[1]);
                }
            });
        }

        //增加常见问题点击数
        function AddCount(id) {
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "html",
                data: { action: "AddCount", qid: id },
                success: function (result) {
                    window.location.href = "ep_question_detail.aspx?count=" + result + "&qid=" + id;
                }
            });
        }
        //生成第一级问题类型
        function GetBigClassNav(tid) {
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "html",
                data: { action: "GetBigClassNav", tid: tid },
                success: function (result) {
                    $(".cq_labcnt .bigclassnav").html(result);
                    GetSubClassNav(tid);
                }
            });

        }

        //生成问题子类型
        function GetSubClassNav(tid) {
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "html",
                data: { action: "GetSubClassNav", tid: tid },
                success: function (result) {
                    $(".cq_labcnt .subclassnav").html(result);
                    if (result == "") {
                        $(".cq_labcnt .subclassnav").hide();
                        GetQuestionByType($('#hid_questionsolve').val(), tid, 11);
                    }
                    else {
                        $(".cq_labcnt .subclassnav").show();
                        GetQuestionByType($('#hid_questionsolve').val(), tid, 10);
                    }
                }
            });
        }


    </script>
    <style type="text/css">
        #cq_queset2
        {
            cursor: hand;
        }
        #cp_queset1
        {
            cursor: hand;
        }
    </style>
    <div class="posbar dpbar2">
        <div class="posi">
            <a href="ep_question_list.htm">常见问题</a> > <a href="javascript:void(0)" id="solvQuestion">
                已解决问题</a></div>
    </div>
    <!--战法首页内容-->
    <div class="mbody3">
        <div class="cq_left">
            <div class="cq_labnavi">
                <a href="javascript:void(0)" onclick="GetSolutionQ(1) ">
                    <div class="lnav lnav0" id="solve_1">
                    </div>
                </a><a href="javascript:void(0)" onclick="GetSolutionQ(0)">
                    <div class="lnav lnav1" id="solve_0">
                    </div>
                </a>
            </div>
            <div class="cq_labcnt">
                <div class="bigclassnav" style="overflow: hidden; padding-top:0px; margin-top:10px;">
                </div>
                <div class="subclassnav" style="overflow: hidden;">
                </div>
                <div class="lcnt">
                    <ul id="listQuestion">
                        <asp:Repeater ID="Repeater1" runat="server">
                            <ItemTemplate>
                                <li><span>Q<%#Container.ItemIndex+1%>：</span><a href="javascript:void(0)" onclick='AddCount(<%#Eval("id") %>)'><%#Eval("Title")%></a></li>
                            </ItemTemplate>
                        </asp:Repeater>
                    </ul>
                    <div class="pageline" id="pageline">
                        <div id="Pagination" class="Pagination">
                        </div>
                        <webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="1" UrlPaging="True"
                            Visible="false" OnPageChanged="AspNetPager1_PageChanged" FirstPageText="第一页"
                            LastPageText="最后一页" NextPageText="下一页" PrevPageText="上一页">
                        </webdiyer:AspNetPager>
                    </div>
                </div>
            </div>
        </div>
        <div class="cq_right">
            <div class="cq_tit_r">
                在线提问</div>
            <div class="cq_queset1" id="cp_queset1" style="cursor:pointer;">
            </div>
            <div class="cq_queset2" id="cq_queset2" style="cursor:pointer;">
            </div>
            <div class="cq_kefu">
            </div>
        </div>
        <div class="clr">
        </div>
    </div>
    <!--战法内容结束-->
    <input type="hidden" id="hid_questionsolve" />
    <input type="hidden" id="hid_questiontype" />
    <input type="hidden" id="hid_thispage" />
</asp:Content>
